Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are two functions cast the line's endpoints to int value for get the unique value. The two functions are
"_determine_number_of_rows_and_columns" and "_determine_table_cell_boundaries". This conversion causes "_is_unbroken" function run error.
I read this part of code. Usually to judging intersection between the lines based on their distance of the line's x / y value.
But the function "_determine_table_cell_boundaries" violate this convention for get the unique value. And then the function "_is_unbroken" use the converted int value.
This will throws an error: "A Rectangle must have a non-negative height" sometimes.
Example:
original:
xs: [110.81, 484.49, 110.81, 484.49, 110.81, 484.49, 111.05, 111.05, 207.35, 207.35, 262.85, 262.85, 315.65, 315.65, 430.25, 430.25, 484.25, 484.25]
ys: [526.19, 526.19, 557.89, 557.89, 647.49, 647.49, 525.95, 647.25, 525.95, 647.25, 525.95, 647.25, 525.95, 647.25, 525.95, 647.25, 525.95, 647.25]
sorted unique
xs: [110, 111, 207, 262, 315, 430, 484]
ys:[525, 526, 557, 647]
In addition, the code "min(l.y0, l.y1) <= r.get_y() and max(l.y0, l.y1) >= r.get_y() + r.get_height()" in function "_is_unbroken", r.get_y() used converted value but l.y0 / l.y1 use the original value. Converted value must <= original value, so the above code will return false aways when l and r has same endpoint.
The commit for fix the problem above.